package com.itheima.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.mapper.DeptMapper;
import com.itheima.pojo.Dept;
import com.itheima.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class DeptServiceImpl extends ServiceImpl<DeptMapper , Dept> implements DeptService {
/*    @Autowired
    private DeptMapper deptMapper;

    @Override
    public List<Dept> queryAll() {

        return deptMapper.selectList(null);
    }

    @Override
    public void deleteById(Integer id) {
        deptMapper.deleteById(id);

    }

    @Override
    public void add(Dept dept) {
        //补充数据
        dept.setCreateTime(LocalDateTime.now());
        dept.setUpdateTime(LocalDateTime.now());
        //调用mapper执行insert
        deptMapper.insert(dept);

    }

    @Override
    public Dept findById(Integer id) {
        return deptMapper.selectById(id);

    }

    @Override
    public void updateById(Dept dept) {
        dept.setUpdateTime(LocalDateTime.now());
        //调用mapper执行update语句
       deptMapper.updateById(dept);
    }*/
}
